﻿using Microsoft.Extensions.Configuration;

namespace Joy.Erp.Ufida.Core
{
    public class U9ApiConfigService : UfidaAppService, IU9ApiConfigService
    {
        private readonly IConfiguration _configuration;

        public U9ApiConfigService(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        public U9ApiConfig GetDefaultConfig()
        {
            var configurationSection = _configuration.GetSection("U9WebApi");

            return new U9ApiConfig
            {
                BaseUrl = configurationSection["BaseUrl"],
                ClientId = configurationSection["ClientId"],
                ClientSecret = configurationSection["ClientSecret"],
                EntCode = configurationSection["EntCode"],
                UserCode = configurationSection["UserCode"],
                OrgCode = configurationSection["OrgCode"],
            };
        }
    }
}
